Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explained the need to support database downgrading #6366

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Aug 22, 2024

Closes #6315

Why is this the best possible solution? Were any other approaches considered?

We have discussed the issue and agreed that since downgrading is not officially supported we should stop handling it in our codebase.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Downgrading isn't officially supported, so we don't typically test for it. I believe we can skip testing in this case as well. A code review by @seadowg.

Do we need any specific form for testing your changes? If so, please attach one.

No.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 changed the title Collect 6315 Explained the need to support database downgrading Aug 22, 2024
@grzesiek2010 grzesiek2010 requested a review from seadowg August 22, 2024 09:47
/**
* Downgrading an app is generally not officially supported without first uninstalling
* the current version. However, it may be possible in some cases, depending on the app
* and device. Rooted devices, for example, might allow more direct downgrades.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! Seeing this, I'm actually leaning towards the oppositive and just exploding if we get a call to onDowngrade. I think the idea that data gets cleared out might be more dangerous than just crashing and letting the user export the data if they still need it or at least understand that they're in a bad state. Would be good to get input from @lognaturel on this as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting let's see what @lognaturel thinks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an error message that I think would be helpful to someone in this state: "Downgrading ODK Collect is not supported. If you need the forms and data that ODK Collect currently manages, you must upgrade to the version you used previously or a newer version. If you don't need the data, you can uninstall this version and then reinstall it again."

Does that sound right? If so, let's go with something like that. It doesn't need to be translated.

Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on a call, we're going to just throw an exception with a message like "App downgrade not supported" if onDowngrade is called.

@grzesiek2010
Copy link
Member Author

grzesiek2010 commented Aug 27, 2024

As discussed on a call, we're going to just throw an exception with a message like "App downgrade not supported" if onDowngrade is called.

This exception is thrown by default by SQLiteOpenHelper if onDowngrade is not implemented:

throw new SQLiteException("Can't downgrade database from version " +
                oldVersion + " to " + newVersion);

I think it's enough we don't need to change it.

@seadowg seadowg merged commit 9493502 into getodk:master Aug 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate the need to support database downgrading
3 participants